//
//  MovieCell.m
//  MtimeMovie
//
//  Created by lllyyy on 15/7/20.
//  Copyright (c) 2015年 lllyyy. All rights reserved.
//

#import "MovieCell.h"
#import "UIImageView+WebCache.h"
#import "Header.h"
@implementation MovieCell


- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
    }
    return self;
}

- (void)awakeFromNib {
    // Initialization code
    _titleLabel.text = _modal.title;
    _yearLabel.text = _modal.year;
}

- (void)setModel:(MovieModel *)modal{
    _modal = modal;
    [self setNeedsLayout];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    _titleLabel.text = _modal.title;
    _yearLabel.text = [NSString stringWithFormat:@"年份:%@",_modal.year];
    _averageLabel.text = [NSString stringWithFormat:@"%.1f",_modal.average];
    NSString *imageStr = [_modal.images objectForKey:@"small"];
    NSURL *url = [NSURL URLWithString:imageStr];
    [self.iconImage sd_setImageWithURL:url];
    _starView.average = _modal.average;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
